package com.hfjava.question.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.hfjava.question.dto.R;
import com.hfjava.question.dto.RUtils;
import com.hfjava.question.interfaces.ClassService;
import com.hfjava.question.pojo.Class;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/class")
public class ClassController {

    @Reference(version = "1.0.0",interfaceClass= ClassService.class,check = false)
    private ClassService classService;

    @CrossOrigin(origins = "http://localhost:8088")
    @RequestMapping("/list")
    public R listClass(){
        List<Class> classList = classService.findAllClass();
        return RUtils.returnSuccess(classList);
    }
}
